import { post } from '@/request/http'
// import { toString } from '@/utils/utils'
import store from '@/store'

// 订单管理 接口

//订单状态下拉框
export const theOrderManageDdzt =() =>
  post(
    '/FTKJWLHYPT/orderManagement/queryRefCodeList',
    {doMain:'订单状态'}
  )

// 创建人下拉框
export const createUserListMethod =() =>
  post(
    '/FTKJWLHYPT/dropDown/getCreateUser',
    {
      ordDepId:store.state.user.DPTID_DX_H
    }
  )

//默认查询加载数据
export const getDataListMethod =(data) =>
  post(
    '/FTKJWLHYPT/orderManagement/list',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            odcCode:data.odcCode,   //订单号
            odcConsigner:data.odcConsigner,         //委托人
            odcStatus:data.odcStatus,           //订单状态
            ordCreatetimeStart:data.ordCreatetimeStart,  //下单开始时间
            ordCreatetimeEnd:data.ordCreatetimeEnd,    //下单结束时间
            // odcCreator:data.odcCreator,      //创建人
            ordIshydc:data.ordIshydc,    //是否海运
            ordIsblpz:data.ordIsblpz,     //是否配载
            ordEtpId:store.state.user.FLT_UUID_DX_H,
            odcCreator:store.state.user.USR_CODE_DX_H
          }
        },
        Orderbys: {},
        PageIndexs: {
          FTKJWLHYPT: data.PageIndexs
        },
        PageSizes: {
          FTKJWLHYPT: data.PageSizes
        }
      }
    }
  )
  //查询客户下拉框
export const  theOrderManageDdKh=() =>
  post(
    '/FTKJWLHYPT/orderManagement/queryClientList',
    {}
  )
//查询解决方案
export const  theOrderManageJjfa=(data) =>
  post(
    '/FTKJWLHYPT/orderManagement/getProductList',
    {
      pdtStatus:data.pdtStatus
    }
  )

//起始地  目的地
export const  theOrderManageDdQsd=() =>
  post(
    '/FTKJWLHYPT/dropDown/getqueryCtiyetList',
    {}
  )


//起始港 和 目的港 下拉框
export const  theOrderManageDdQsg=() =>
  post(
    '/FTKJWLHYPT/dropDown/getqueryProductList',
    {}
  )


//尺寸下拉框
export const  theOrderManageDCc=(data) =>
  post(
    '/FTKJWLHYPT/dropDown/GetModelContatinerSizes',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            cszCsizecd:data.cszCsizecd,
            cszCsizenm:data.cszCsizenm,
            cszName:data.cszName
          }
        },
      }
    }
  )
  // 箱型下拉框
export const  theOrderManageDXX=(data) =>
  post(
    '/FTKJWLHYPT/dropDown/GetContainerTypes',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            ctpCommcode:data.ctpCommcode,
            ctpName:data.ctpName
          }
        },
      }
    }
  )
  // 货物分类下拉框
export const  theOrderManageDHW=() =>
  post(
    '/FTKJWLHYPT/orderManagement/queryGoogsTypeList',
    {}
  )
  // 包装下拉框
export const  theOrderManageDBZ=() =>
  post(
    '/FTKJWLHYPT/orderManagement/queryRefCodeList',
    {doMain:'包装方式'}
  )
  //运输分类下拉框
export const  theOrderManageYsfl=() =>
  post(
    '/FTKJWLHYPT/orderManagement/queryRefCodeList',
    {doMain:'运输分类'}
  )
  //省下拉框
export const  theOrderManageSheng=(data) =>
  post (
    '/FTKJWLHYPT/dropDown/selectPrvInfosByPrvCtyCd',
    {
      ctycd:data.ctycd
    }
  )
  //市下拉框
export const  theOrderManageShi=(data) =>
  post (
    '/FTKJWLHYPT/dropDown/selectCityByPrCode',
    {
      pvCode:data.pvCode
    }
  )
  //区县下拉框
export const  theOrderManageQu=(data) =>
  post(
    '/FTKJWLHYPT/dropDown/electCityByctyPrvCode',
    {
      cityCode:data.prvcode
    }
  )
  //
export const  theOrderManageKhxy=(data) =>
  post(
    '/FTKJWLHYPT/dropDown/electCityByctyPrvCode',
    {
      cityCode:data.prvcode
    }
  )
//新增
export const  theOrderManageDXZ=(data) =>
  post(
    '/FTKJWLHYPT/orderManagement/addOrderDetail',
    {
      basicInfo: {
        odcEtpId:store.state.user.FLT_UUID_DX_H,      //企业ID
        odcCltId:data.odcCltId || '',      //客户ID
        orGoodowner:data.orGoodowner|| '',  //货主
        odcLinkperson:data.odcLinkperson|| '', //联系人
        odcLinkphone:data.odcLinkphone|| '', //联系电话
        odcTel:data.odcTel|| '',  //手机
        odcEmail:data.odcEmail || '', //email
        odcQq:data.odcQq|| '', //qq
        odcWechat:data.odcWechat|| '',//微信
        orShipper:data.orShipper|| '', //发货方
        orShippercontacts:data.orShippercontacts|| '', //发货联系人
        orShippertel:data.orShippertel|| '', //发货人联系方式
        orReveivingparty:data.orReveivingparty|| '', //收货方
        orReveivingpartycontacts:data.orReveivingpartycontacts|| '' ,//收货联系人
        orReveivingpartytel:data.orReveivingpartytel|| '', //收货方联系方式
        odcRemark:data.odcRemark|| '',  //备注
        odcOperator:data.odcOperator|| '', //当前操作人员
        odcConsigner:data.odcConsigner || '', //委托人
        odcCreator:store.state.user.USR_CODE_DX_H//创建人
      },

      //服务信息
      serviceInfo: {
        odcPdtId:data.odcPdtId || '',
        odcWorktime:data.odcWorktime || '', //作业天数
        orTransportsort:data.orTransportsort || '',  //运输分类
        orIE:data.orIE || '', //进出口标识
        orStartplace:data.orStartplace || '', //起始地
        orEndplace:data.orEndplace || '',  //目的地
        odcLoadport:data.odcLoadport || '', //起始港
        odcDestinationport:data.odcDestinationport || ''  //目的港
      },

      //箱信息
      Amount: data.Amount,

      //货物信息
      Goods: data.Goods,

      //发货地服务
      Send:{
        odcSPeople:data.odcSPeople || '', //发货地联系人
        odcSPhone:data.odcSPhone || '', //发货地联系电话
        odcSTruckfg:data.odcSTruckfg || '', //发货地拖车标识
        odcSCountry:data.odcSCountry || '', //发货地国家
        odcSProvince:data.odcSProvince || '', //发货地省
        orDeliverypointcity:data.orDeliverypointcity || '', //发货市
        // odcSArea:data.odcSArea || '',  //发货地区县
        odcSArea:data.odcSArea || '',  //发货地区县
        odcSAddress:data.odcSAddress || '' //发货地地址
      },
      //收货地服务
      Reveiv:{
        odcDTruckfg:data.odcDTruckfg || '',  //收货地拖车标识
        odcDCountry:data.odcDCountry || '', //收货地国家
        odcDProvince:data.odcDProvince || '', //收货地省
        orReveivingpartytelcity:data.orReveivingpartytelcity || '', //收货市
        odcDArea:data.odcDArea || '',  //收货地区县
        odcDAddress:data.odcDAddress || '',  //收货地地址

        odcDPeople:data.odcDPeople || '',   //收货地联系人
        odcDPhone:data.odcDPhone || ''  //收货地联系电话
      }
    }
  )

//编辑  查询信息
export const  theOrderManageBj=(data) =>
  post (
    '/FTKJWLHYPT/orderManagement/detail',
    {
      odcId:data.odcId,
      odcEtpId:store.state.user.FLT_UUID_DX_H
    }
  )
  //编辑 点击保存
export const  theOrderManageBJList=(data) =>
  post(
    '/FTKJWLHYPT/orderManagement/editOrderDetail',
    {
      basicInfo: {
        odcClNAME:data.odcClNAME || '',
        ordId:data.ordId || '',      //ordId
        odcId:data.odcId || '',      //odcId
        odcEtpId:store.state.user.FLT_UUID_DX_H,      //企业ID
        odcCltId:data.odcCltId || '',      //客户ID
        orGoodowner:data.orGoodowner|| '',  //货主
        odcLinkperson:data.odcLinkperson|| '', //联系人
        odcLinkphone:data.odcLinkphone|| '', //联系电话
        odcTel:data.odcTel|| '',  //手机
        odcEmail:data.odcEmail || '', //email
        odcQq:data.odcQq|| '', //qq
        odcWechat:data.odcWechat|| '',//微信
        orShipper:data.orShipper|| '', //发货方
        orShippercontacts:data.orShippercontacts|| '', //发货联系人
        orShippertel:data.orShippertel|| '', //发货人联系方式
        orReveivingparty:data.orReveivingparty|| '', //收货方
        orReveivingpartycontacts:data.orReveivingpartycontacts|| '' ,//收货联系人
        orReveivingpartytel:data.orReveivingpartytel|| '', //收货方联系方式
        odcRemark:data.odcRemark|| '',  //备注
        odcOperator:data.odcOperator|| '', //当前操作人员
        odcConsigner:data.odcConsigner || '', //委托人
        odcCreator:store.state.user.USR_CODE_DX_H//创建人
      },

      //服务信息
      serviceInfo: {
        odcPdtId:data.odcPdtId || '',
        odcWorktime:data.odcWorktime || '', //作业天数
        orTransportsort:data.orTransportsort || '',  //运输分类
        orIE:data.orIE || '', //进出口标识
        orStartplace:data.orStartplace || '', //起始地
        orEndplace:data.orEndplace || '',  //目的地
        odcLoadport:data.odcLoadport || '', //起始港
        odcDestinationport:data.odcDestinationport || ''  //目的港
      },

      //箱信息
      // Amount: [{
      //   taaCntrsize:data.taaCntrsize || '', //尺寸
      //   taaCntrtype:data.taaCntrtype || '', //箱型
      //   taaQuantity:data.taaQuantity || '',//数量
      // }],
      Amount: data.Amount,

      //货物信息
      Goods: data.Goods,

      //发货地服务
      Send:{
        odcSPeople:data.odcSPeople || '', //发货地联系人
        odcSPhone:data.odcSPhone || '', //发货地联系电话
        odcSTruckfg:data.odcSTruckfg || '', //发货地拖车标识
        odcSCountry:data.odcSCountry || '', //发货地国家
        odcSProvince:data.odcSProvince || '', //发货地省
        orDeliverypointcity:data.orDeliverypointcity || '', //发货市
        odcSArea:data.odcSArea || '',  //发货地区县
        odcSAddress:data.odcSAddress || '' //发货地地址
      },
      //收货地服务
      Reveiv:{
        odcDTruckfg:data.odcDTruckfg || '',  //收货地拖车标识
        odcDCountry:data.odcDCountry || '', //收货地国家
        odcDProvince:data.odcDProvince || '', //收货地省
        orReveivingpartytelcity:data.orReveivingpartytelcity || '', //收货市
        odcDArea:data.odcDArea || '',  //收货地区县
        odcDAddress:data.odcDAddress || '',  //收货地地址
        odcDPeople:data.odcDPeople || '',   //收货地联系人
        odcDPhone:data.odcDPhone || ''  //收货地联系电话
      }
    }
  )
//订单详情  操作服务信息  列表
export const  theOrderManageDetailsList=(data) =>
  post (
    '/FTKJWLHYPT/orderManagement/queryOperSerList',
    {
      ordId:data.ordId,
      ordEtpId:store.state.user.FLT_UUID_DX_H
    }
  )
  //订单详情  操作服务信息 新增
export const  theOrderManageDetailsAdd=(data) =>
  post (
    '/FTKJWLHYPT/frtOrder/addOperationservice',
    {
      optOrdcode:data.optOrdcode,   //订单代码
      optSequence:data.optSequence,  //操作序列
      optType:data.optType,    //操作类型
      optEtpId:store.state.user.FLT_UUID_DX_H,
      optDepId:data.optDepId,
      optCreator:store.state.user.USR_CODE_DX_H, //录入人

      optChanger:store.state.user.USR_CODE_DX_H,  //修改人

      optRemark:data.optRemark, //备注
      optStartplace:data.optStartplace, //起始港
      optEndplace:data.optEndplace,  //目的港
      orderId:data.ordId , //订单id
    }
  )
//订单详情  操作服务信息 删除
export const  theOrderManageDetailsdel=(data) =>
  post (
    '/FTKJWLHYPT/frtOrder/delOperationservice',
    {
      optId:data.optId,
    }
  )
//订单详情  操作服务信息 新增 操作类型下拉框
export const  theOrderManageCzlx=(data) =>
  post (
    '/FTKJWLHYPT/orderManagement/queryRefCodeList',{
      doMain:data.doMain
    }
  )

//订单详情  服务动态列表 列表
export const  theOrderManageFwList=(data) =>
  post (
    '/FTKJWLHYPT/frtOrder/getVwActivitesModelList',
    {
      lac_ord_id:data.lac_ord_id
    }
  )
//订单详情  服务动态列表 新增 作业动态下拉框
export const  theOrderManageZyztwList=(data) =>
  post (
    '/FTKJWLHYPT/orderManagement/queryRefCodeList',
    {
      doMain:data.doMain
    }
  )
//订单详情  服务动态列表 动态录入 保存
export const  theOrderManageBcList=(data) =>
  post (
    '/FTKJWLHYPT/frtOrder/saveServerDyc',
    {
      lacCtrId:data.lacCtrId, //箱ID
      lacGdsId :data.lacGdsId, //货Id
      lacOrdId:data.ordId, //订单ID
      lacOpprc:data.lacOpprc,   //动作
      lacOptm:data.lacOptm, // 作业时间
      lacAddress:data.lacAddress, //作业地点
      lacContent:data.lacContent,  //内容
      lacCreater:store.state.user.USR_CODE_DX_H,  //操作人
      lacLstupduser:store.state.user.USR_CODE_DX_H, //操作人
      lacRemark:data.lacRemark,   //备注
      lacInId:data.lacInId,  //录入id
      lacFb:data.lacFb, //是否发布
    }
  )
  //订单详情  服务动态列表 动态录入 编辑
export const  theOrderManageBjeidt=(data) =>
  post (
    '/FTKJWLHYPT/frtOrder/saveEditServerDyc',
    {
      lacId:data.lacId,
      lacCtrId:data.lacCtrId, //箱ID
      lacGdsId :data.lacGdsId, //货Id
      lacOpprc:data.lacOpprc,   //动作
      lacOptm:data.lacOptm, // 作业时间
      lacAddress:data.lacAddress, //作业地点
      lacContent:data.lacContent,  //内容
      lacCreater:store.state.user.USR_CODE_DX_H,  //操作人
      lacLstupduser:store.state.user.USR_CODE_DX_H, //操作人
      lacRemark:data.lacRemark,   //备注
      lacInId:data.lacInId,  //录入id
      lacFb:data.lacFb, //是否发布
      lacOrdId:data.ordId //订单ID
    }
  )
//订单详情  服务动态列表 动态录入 删除
export const  theOrderManageyxqdel=(data) =>
  post (
    '/FTKJWLHYPT/frtOrder/deleteServerDyc',
    {
      lacId :data.lacId, //动态id
    }
  )
//订单详情  服务动态列表 动态录入 发布 取消发布
export const  theOrderManageyxqFb=(data) =>
  post (
    '/FTKJWLHYPT/orderManagement/publicOrCancelP',
    {
      // lacIdStr:data.lacId,  //主键ID 多个逗号拼接
      lacIdStr:data.lacIdStr,  //主键ID 多个逗号拼接
      lacFb:data.lacFb, //发布是Y  取消发布是N
    }
  )



//取消订单
export const  theOrderManageQxdd=(data) =>
  post (
    '/FTKJWLHYPT/orderManagement/cancelOrder',
    {
      updateUser:store.state.user.USR_CODE_DX_H, //修改人
      ordId :data.ordId, //订单id
    }
  )
//删除订单
export const  theOrderManagedel=(data) =>
  post (
    '/FTKJWLHYPT/orderManagement/deleteOrder',
    {
      V_ORD_ID :data.V_ORD_ID, //订单id
    }
  )
//订单审核  取消审核
export const  theOrderManageDdsh=(data) =>
  post (
    '/FTKJWLHYPT/orderManagement/auditOrder',
    {
      V_ORD_ID:data.V_ORD_ID, //订单编号
      V_ORD_STATUS:data.V_ORD_STATUS, //订单状态
      V_ORD_AUDITDIFFERING:data.V_ORD_AUDITDIFFERING,  //审核意见
      V_ORD_AUDITOR:store.state.user.USR_CODE_DX_H, //审核人
      V_ODC_ID:data.V_ODC_ID, //订单资料ID
      V_ODC_CURRENCY:data.V_ODC_CURRENCY, //币种
      V_ODC_CLIENTXY:data.V_ODC_CLIENTXY,   //协议id
      V_ODC_YSTOTALFEE:data.V_ODC_YSTOTALFEE  //总金额
    }
  )

//选择费目  费目列表  查询
export const  getFeeListService =(data) =>
  post (
    '/FTKJWLHYPT/freightForwardBusiness/getTmsChargePriceList',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            chiCnname: data.chiCnname, // 产品类型 -->费目名称
            bpsign: data.bpsign, // 收支标志
            currency: data.currency,  // 币种
            fltId: store.state.user.FLT_UUID_DX_H,
          }
        },
        Orderbys: {},
        PageIndexs: {
          FTKJWLHYPT: data.PageIndexs
        },
        PageSizes: {
          FTKJWLHYPT: data.PageSizes
        }
      }
    }
  )
